package com.program.cloudmanagesystem.hotel.service;

import com.program.cloudmanagesystem.hotel.domain.Hotel;
import com.program.cloudmanagesystem.hotel.persistence.HotelMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HotelService {
    @Autowired
    private HotelMapper HotelMapper;
    public HotelService(){}
    public List<Hotel> showHotels(){
        return HotelMapper.showHotels();
    }
    public Hotel searchHotel(String id){
        return HotelMapper.searchHotel(id);
    }
    public List<Hotel> searchHotelsByname(String name){
        return HotelMapper.searchHotelByName(name);
    }
    public void insertHotel(Hotel hotel){
        HotelMapper.insertHotel(hotel.getId(), hotel.getName(), hotel.getMaxcapacity(), hotel.getMaxparking(), hotel.getMaxcheck(),hotel.getLocation(), hotel.getInformation());
    }
    public void deleteHotel(String id)
    {
        HotelMapper.deleteHotel(id);
    }
    public void updateData(Hotel hotel)
    {
        HotelMapper.updateData(hotel.getId(), hotel.getName(), hotel.getMaxcapacity(), hotel.getMaxparking(),hotel.getMaxcheck(), hotel.getLocation(), hotel.getInformation(),hotel.getScore());
    }

    public void updateNow(Hotel hotel) {
        HotelMapper.updateNow(hotel.getId(), hotel.getCapacity(), hotel.getParking(), hotel.getCheck());
    }
    public void updateScore(Hotel hotel) {
        HotelMapper.updateScore(hotel.getId(), hotel.getScore());
    }

}
